package gqz.avdemo.player;

import android.os.Bundle;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.view.View;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

import gqz.avdemo.R;

/**
 * Description
 *
 * @author gqz
 * @date 2020/12/21
 */
public class PlayerAct extends AppCompatActivity implements SurfaceHolder.Callback {

   private SurfaceView surface;
   private SocketLive live;

   @Override
   protected void onCreate(@Nullable Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.act_player);
      surface = findViewById(R.id.player_surface);
      surface.getHolder().addCallback(this);
   }

   @Override
   protected void onDestroy() {
      super.onDestroy();
   }

   @Override
   public void surfaceCreated(SurfaceHolder holder) {
      live = new SocketLive(holder.getSurface());
   }

   @Override
   public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {

   }

   @Override
   public void surfaceDestroyed(SurfaceHolder holder) {
      live.onDestroy();
   }
}
